﻿using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace Transitions
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }

        private void Button_Click_0(object sender, RoutedEventArgs e) { AddItem(ItemStack0); }
        private void Button_Click_1(object sender, RoutedEventArgs e) { AddItem(ItemStack1); }
        private void Button_Click_2(object sender, RoutedEventArgs e) { AddItem(ItemStack2); }
        private void Button_Click_3(object sender, RoutedEventArgs e) { AddItem(ItemStack3); }
        private void Button_Click_4(object sender, RoutedEventArgs e) { AddItem(ItemStack4); }

        //private void Button_Click_10(object sender, RoutedEventArgs e) { AddItem(ItemStack10); }
        //private void Button_Click_11(object sender, RoutedEventArgs e) { AddItem(ItemStack11); }
        //private void Button_Click_12(object sender, RoutedEventArgs e) { AddItem(ItemStack12); }
        //private void Button_Click_13(object sender, RoutedEventArgs e) { AddItem(ItemStack13); }
        //private void Button_Click_14(object sender, RoutedEventArgs e) { AddItem(ItemStack14); }

        void AddItem(StackPanel panel)
        {
            var button = new Button
            {
                Margin = new Thickness(10),
                Padding = new Thickness(10),
                Content = "Click to remove me",
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch,
            };
            button.Click += (b, e) => panel.Children.Remove((Button)b);
            panel.Children.Insert(0, button);
        }
    }
}
